#ifndef DATACOLLECTOR_H
#define DATACOLLECTOR_H

#include <QString>
#include <QStringList>
#include <QDirIterator>
#include <QFileInfo>
#include <QDir>
#include <QThread>
#include <QSharedPointer>
#include <QRegExp>

#include "defines.h"
#include "movie.h"

class DataCollector : public QThread
{
    Q_OBJECT
public:
    ///
    /// @param  dir     Reference to the data directory
    /// @param  parent  Pointer to the parent object
    /// Initialize the data collector
    DataCollector(const QDir &dir, QObject *parent = 0);

    ///
    /// Starts the scanning
    void run();

    ///
    /// @return     A const reference to file list
    ///
    /// Returns a const reference to the file list result from scanning
    const MovieList& getFileList() const;

private slots:
    ///
    /// An event to stop the scanning process
    void stop();

private:
    QDirIterator iterator_;         ///< The directory iterator to the scan path
    bool stopped_;                  ///< Scan stopped
    MovieList movieList_;           ///< Movie collection list
};

#endif // DATACOLLECTOR_H
